package com.icangya.domain;

import org.hibernate.annotations.Type;

import javax.persistence.*;
import java.sql.Timestamp;

@Entity
@Table(name = "fb_user")
public class User {

    /*
    * 用户编号
    * */
    private Long id;

    /*
    * 用户微信id
    * */
    private String openId;

    /*
    *微信昵称
    * */
    private String nickName;

    /*
    * 用户微信头像
    * */
    private String headImgUrl;

    private Timestamp createTime;//用户注册的时间

    /*
    *上线用户id
    * */
    private Long parentId;

    /*
    *用户二维码
    * */
    private String QrCode;

    /*
    *代理用户id
    * */
    private Long proxyId;


    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }
    @Basic
    @Column(name = "openid")
    public String getOpenId() {
        return openId;
    }

    public void setOpenId(String openId) {
        this.openId = openId;
    }
    @Basic
    @Column(name = "nick_name")
    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    @Basic
    @Column(name = "headimgurl")
    public String getHeadImgUrl() {
        return headImgUrl;
    }

    public void setHeadImgUrl(String headImgUrl) {
        this.headImgUrl = headImgUrl;
    }

    @Basic
    @Column(name = "parent_id")
    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    @Lob
    @Basic
    @Type(type = "text")
    @Column(name = "qr_code")
    public String getQrCode() {
        return QrCode;
    }

    public void setQrCode(String qrCode) {
        QrCode = qrCode;
    }

    @Basic
    @Column(name = "proxy_id")
    public Long getProxyId() {
        return proxyId;
    }

    public void setProxyId(Long proxyId) {
        this.proxyId = proxyId;
    }

    @Basic
    @Column(name = "create_time")
    public Timestamp getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Timestamp createTime) {
        this.createTime = createTime;
    }

    public User(String openId, String nickName, String headImgUrl, Timestamp createTime, Long parentId, String qrCode, Long proxyId) {
        this.openId = openId;
        this.nickName = nickName;
        this.headImgUrl = headImgUrl;
        this.createTime = createTime;
        this.parentId = parentId;
        QrCode = qrCode;
        this.proxyId = proxyId;
    }

    public User(String openId, String nickName, String headImgUrl, Long parentId, String qrCode, Long proxyId) {
        this.openId = openId;
        this.nickName = nickName;
        this.headImgUrl = headImgUrl;
        this.parentId = parentId;
        this.QrCode = qrCode;
        this.proxyId = proxyId;
    }

    public User() {
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", openId='" + openId + '\'' +
                ", nickName='" + nickName + '\'' +
                ", headImgUrl='" + headImgUrl + '\'' +
                ", createTime=" + createTime +
                ", parentId=" + parentId +
                ", QrCode='" + QrCode + '\'' +
                ", proxyId=" + proxyId +
                '}';
    }
}
